class Admin::ForumsController < Admin::AdminApplicationController
  layout "admin"
  before_filter :admin_login_required
  
  def index
    @forums_pages, @forums = paginate :forums, :conditions => ["type = 'CommonForum'"], :per_page => 15
  end
  
  def show
    @forum = CommonForum.find(params[:id])
  end
  
  def edit
    @forum = CommonForum.find(params[:id])
    return unless request.post?
    if @forum.update_attributes(params[:forum])
      redirect_to admin_forum_url(@forum)
    else
      render :action => 'edit'
    end
  end
  
  def new
    @forum = CommonForum.new(params[:forum])
    return unless request.post?
    if @forum.save
      redirect_to admin_forum_url(@forum)
    else
      render :action => 'new'
    end
  end
end
